﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Data;
using System.Data.SqlClient;
using QLCONGNOLIBS.Models;
using QLCONGNOLIBS.Securities;
using QLCONGNOLIBS.Models.EntityFW;

namespace QLCONGNOLIBS.Controllers
{
    public class BaseControllers<T>
    {
        protected SqlConnection m_objConnection;
        protected SecurityEntity m_objSecurity;
        protected UsersModels m_objUserModels;
        protected EmployeeModels m_objEmpModels;
        protected CustomerModels m_objCustModels;
        protected CityModels m_objCityModels;

        public BaseControllers(SqlConnection objConnection, SecurityEntity objSecurity)
        {
            m_objConnection = objConnection;
            m_objSecurity = objSecurity;
            m_objUserModels = new UsersModels(objConnection, objSecurity);            
            m_objEmpModels = new EmployeeModels(objConnection, objSecurity);
            m_objCustModels = new CustomerModels(objConnection, objSecurity);
            m_objCityModels = new CityModels(objConnection, objSecurity);
        }

        public virtual DataTable ExecOfGetElements() { return null; }
        public virtual DataTable ExecOfGetElementById(object obj) { return null; }
        public virtual DataTable ExecOfCheckElement(T obj) { return null; }
        public virtual bool ExecOfInsertElement(T obj) { return true; }
        public virtual bool ExecOfUpdateElement(T obj) { return true; }
        public virtual bool ExecOfInsertUpdateElement(T obj, short shOpt) { return true; }
        public virtual bool ExecOfDeleteElement(T obj) { return true; }
        public virtual DataTable ExecOfFindElement() { return null; }
    }
}
